package com.tbm.console.common.domain;

import com.tbm.console.common.constant.ConsoleConstant;
import lombok.Data;

@Data
public class ResultCode<T> {

    //信息码
    private Integer code;
    //信息描述
    private String msg;
    //实体类
    private T data;

    public ResultCode(){

    }
    public ResultCode(Integer code){
        this.code = code;
        //成功
        if(code == ConsoleConstant.STATE_FAIL_CODE){
            this.msg = ConsoleConstant.STATE_SUCCESS_MSG;
        //失败
        }else{
            this.msg = ConsoleConstant.STATE_FAIL_MSG;
            this.data = null;
        }

    }

}
